package com.noble.meether.fragment.rob.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.noble.library.base.bean.BaseData;

import org.json.JSONObject;

/**
 * 女性：抢聊大厅解析类
 */
public class Rob extends BaseData implements Parcelable {
    private long vcId;      // 通信渠道ID
    private long uid;       // 对方用户uid
    private String nickName;
    private String avatar;
    private String cName;   //  一对一通信, Ckey是收到男性同意消息时携带过来的
    private int vipStatus;  // vip状态

    @Override
    public void parseJson(String jsonStr) {
        JSONObject jsonObject = getJsonObject(jsonStr);
        this.setVcId(jsonObject.optLong("Id"));
        this.setUid(jsonObject.optLong("Uid"));
        this.setNickName(jsonObject.optString("NickName"));
        this.setAvatar(jsonObject.optString("Avatar"));
        this.setcName(jsonObject.optString("CName"));
        this.setVipStatus(jsonObject.optInt("IsVip"));
    }

    public boolean isVip() {
        return vipStatus == 1 || vipStatus == 2;
    }

    public int getVipStatus() {
        return vipStatus;
    }

    public void setVipStatus(int vipStatus) {
        this.vipStatus = vipStatus;
    }

    public long getVcId() {
        return vcId;
    }

    public void setVcId(long vcId) {
        this.vcId = vcId;
    }

    public long getUid() {
        return uid;
    }

    public void setUid(long uid) {
        this.uid = uid;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getcName() {
        return cName;
    }

    public void setcName(String cName) {
        this.cName = cName;
    }

    public Rob() {
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(this.vcId);
        dest.writeLong(this.uid);
        dest.writeString(this.nickName);
        dest.writeString(this.avatar);
        dest.writeString(this.cName);
        dest.writeInt(this.vipStatus);
    }

    protected Rob(Parcel in) {
        this.vcId = in.readLong();
        this.uid = in.readLong();
        this.nickName = in.readString();
        this.avatar = in.readString();
        this.cName = in.readString();
        this.vipStatus = in.readInt();
    }

    public static final Creator<Rob> CREATOR = new Creator<Rob>() {
        @Override
        public Rob createFromParcel(Parcel source) {
            return new Rob(source);
        }

        @Override
        public Rob[] newArray(int size) {
            return new Rob[size];
        }
    };
}
